program drop _all
set more off
capture log close

clear
clear matrix

// Install the estout package
// Derived from https://github.com/gslab-econ/template/blob/master/config/config_stata.do

program main
    local ssc_packages "estout"

    if !missing("`ssc_packages'") {
        foreach pkg in `ssc_packages' {
            capture which `pkg'
            if _rc == 111 {                 
               dis "Installing `pkg'"
               quietly ssc install `pkg', replace
               }
        }
    }
	
    capture confirm file $adobase/plus/m/moremata.hlp
        if _rc != 0 {
        cap ado uninstall moremata
        ssc install moremata
        }

end

main                

mata: mata mlib index

local out "_Output/"

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// INPUT DATA //////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

// ECONOMIC GAMES: UNDERGRADUATE STUDENTS STUDY
local undergrad_decision "undergrad_decision.dta"
local undergrad_belief "undergrad_belief.dta"
local undergrad_long "undergrad_long.dta"
local undergrad "undergrad.dta"

// ECONOMIC GAMES: ONLINE PARTICIPANTS STUDY
local online_decision "online_decision.dta" 
local online_belief "online_belief.dta" 
local online_long "online_long.dta" 
local online "online.dta"

// INTERFERING EXPERIENCE STUDY
local interfering_exp_belief "interfering_exp_belief.dta"

// ADDITIONAL DEMOGRAPHICS STUDY
local additional_demographics_long "additional_demographics_long.dta"

// STAKES VARY STUDY
local stakes_decisions "stakes_decisions.dta"
local stakes_beliefs "stakes_beliefs.dta"

// BROADER BELIEFS STUDY
local broader_beliefs_online "broader_beliefs_online.dta"
local broader_beliefs_representative "broader_beliefs_representative.dta"

// BELIEFS ONLY STUDY
local beliefs_only "beliefs_only.dta"

// RECALLED PERSON STUDY
local recalled_person "recalled_person.dta"

// RECALLED EXPERIENCE STUDY
local recalled_experience "recalled_experience.dta"

// INTERFERING EXPERIENCE (ROBUSTNESS) STUDY
local interfering_experience_2 "interfering_experience_2.dta"

// EQUALITY ATTITUDES AND EMPLOYER STUDY
local equality_decisions "equality_decisions.dta"
local equality_beliefs "equality_beliefs.dta"
local equality_beliefs_2 "equality_beliefs_2.dta"
local equality_long "equality_long.dta"

// PROFESSIONAL PARTICIPANTS STUDY
local professional_beliefs "professional_beliefs.dta"
local professional "professional.dta"

// BROADER BELIEFS (EQUALITY ATTITUDES) STUDY

local broader_beliefs_equality "broader_beliefs_equality.dta"

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////// TABLE 1: UNDERGRADUATE STUDENTS //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

foreach s in dneutral dfirstparty { 
clear
clear matrix
use `undergrad_decision'
 
keep if `s' == 1 

foreach g in 1 2 3 4 5 6 7 { 

quietly regress decision_ female male ///
 if scenario == `g' /// 
 , noconstant vce(robust)
eststo d`g'

quietly regress decision_ deltaF ///
 if scenario == `g' /// 
 , vce(robust)
eststo r`g'
}

if ("`s'" == "dfirstparty") {
 local table_name "Table_1_Panel_1" 
 local table_title "Undergraduate Students, First-Party Scenarios"
}

if ("`s'" == "dneutral") {
 local table_name "Table_1_Panel_3"
 local table_title "Undergraduate Students, Third-Party Scenarios"
}

esttab d1 d2 d3 d4 d5 d6 d7 ///
 using `out'`table_name'.tex /// 
 , b(2) not nostar /// 
title("`table_title'") /// 
 mtitles("DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
 nogaps compress /// 
 label /// 
 addnote("Robust SEs") replace 
 
esttab r1 r2 r3 r4 r5 r6 r7 ///
 using `out'`table_name'_Delta.tex /// 
 , b(2) se(2) /// 
title("`table_title': Delta") /// 
 mtitles("DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
 nogaps compress noconstant /// 
 label /// 
 star(* 0.10 ** 0.05 *** 0.01 ) /// 
 addnote("Robust SEs") replace 
}

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////// TABLE 1: ONLINE PARTICIPANTS /////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

foreach s in dneutral dfirstparty { 
clear
clear matrix
use `online_decision'
 
keep if `s' == 1 

foreach g in 1 2 3 4 5 6 7 { 
quietly regress decision_ female male ///
 if scenario == `g' /// 
 , noconstant vce(robust)
eststo d`g'

quietly regress decision_ deltaF ///
 if scenario == `g' /// 
 , vce(robust)
eststo r`g'
}

if ("`s'" == "dfirstparty") {
 local table_name "Table_1_Panel_2" 
 
 local table_title "Online Participants, First-Party Scenarios"
}

if ("`s'" == "dneutral") {
 local table_name "Table_1_Panel_4"
 local table_title "Online Participants, Third-Party Scenarios"
}

esttab d1 d2 d3 d4 d5 d6 d7 ///
 using `out'`table_name'.tex /// 
 , b(2) not nostar /// 
 title("`table_title'") /// 
 mtitles("DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
 nogaps compress /// 
 label /// 
 addnote("Robust SEs") replace 
 
esttab r1 r2 r3 r4 r5 r6 r7 ///
 using `out'`table_name'_Delta.tex /// 
 , b(2) se(2) /// 
 title("`table_title'") /// 
 mtitles("DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
 nogaps compress noconstant /// 
 label /// 
 star(* 0.10 ** 0.05 *** 0.01 ) /// 
 addnote("Robust SEs") replace 
}

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
///////////////////// TABLE 2: UNDERGRADUATE STUDENTS ////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

foreach s in bneutral bfirstparty { 

clear
clear matrix
use `undergrad_belief'
 
keep if `s' == 1 
 
foreach g in 1 2 3 4 5 6 7 { 
quietly regress belief_ deltaBF ///
 if scenario ==`g' /// 
 , vce(cluster subject)
eststo g`g'_iall

quietly regress belief_ bfemale bmale ///
 if scenario ==`g' /// 
 , noconstant vce(cluster subject)
eststo d`g'_iall
} 

if ("`s'" == "bfirstparty") {
 local table_name "Table_2_Panel_1" 
 
 local table_title "Undergraduate Students, Beliefs about First-Party Scenarios"
}

if ("`s'" == "bneutral") {
 local table_name "Table_2_Panel_3"
 local table_title "Undergraduate Students, Beliefs about Third-Party Scenarios"
}

esttab d1_iall d2_iall d3_iall d4_iall d5_iall d6_iall d7_iall ///
 using `out'`table_name'.tex /// 
 , b(2) not nostar /// 
 title("`table_title'") /// 
 mtitles( "DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
 nogaps compress /// 
 label /// 
 addnote("SEs clustered at subject level") replace 
 
esttab g1_iall g2_iall g3_iall g4_iall g5_iall g6_iall g7_iall ///
 using `out'`table_name'_Delta.tex /// 
 , b(2) se(2) /// 
 title("`table_title'") /// 
 mtitles( "DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
 nogaps compress noconstant /// 
 label /// 
 star(* 0.10 ** 0.05 *** 0.01 ) /// 
 addnote("SEs clustered at subject level") replace 

}

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
///////////////////// TABLE 2: ONLINE PARTICIPANTS ///////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

foreach s in bneutral bfirstparty { 

clear
clear matrix
use `online_belief'
 
keep if `s' == 1 
 
foreach g in 1 2 3 4 5 6 7 { 
quietly regress belief_ deltaBF ///
 if scenario ==`g' /// 
 , vce(cluster subject)
eststo g`g'_iall

quietly regress belief_ bfemale bmale ///
 if scenario ==`g' /// 
 , noconstant vce(cluster subject)
eststo d`g'_iall
} 

if ("`s'" == "bfirstparty") {
 local table_name "Table_2_Panel_2" 
 
 local table_title "Online Participants, Beliefs about First-Party Scenarios"
}

if ("`s'" == "bneutral") {
 local table_name "Table_2_Panel_4"
 local table_title "Online Participants, Beliefs about Third-Party Scenarios"
}

esttab d1_iall d2_iall d3_iall d4_iall d5_iall d6_iall d7_iall ///
 using `out'`table_name'.tex /// 
 , b(2) not nostar /// 
 title("`table_title'") /// 
 mtitles( "DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
 nogaps compress /// 
 label /// 
 addnote("SEs clustered at subject level") replace 
 
esttab g1_iall g2_iall g3_iall g4_iall g5_iall g6_iall g7_iall ///
 using `out'`table_name'_Delta.tex /// 
 , b(2) se(2) /// 
 title("`table_title'") /// 
 mtitles( "DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
 nogaps compress noconstant /// 
 label /// 
 star(* 0.10 ** 0.05 *** 0.01 ) /// 
 addnote("SEs clustered at subject level") replace 

}

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
/////////////// FIGURE 1: UNDERGRADUATE STUDENTS /////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

foreach s in bfirstparty bneutral { 

clear
clear matrix
use `undergrad_belief'

keep if `s' == 1 

quietly summarize belief_ if bfemale == 1, detail
local avgF: display %5.1f `r(mean)'

quietly summarize belief_ if bmale ==1, detail
local avgM: display %5.1f `r(mean)'

cumul belief_ if bfemale == 1 , gen(belief_F)
cumul belief_ if bmale == 1 , gen(belief_M)
sort belief_F belief_M

if ("`s'" == "bfirstparty") {
 
 local graph_name "Figure_1_Panel_a"
 local table_title "Undergraduate Students: First-Party Scenarios"
}

if ("`s'" == "bneutral") {
 
 local graph_name "Figure_1_Panel_c"
 local table_title "Undergraduate Students: Third-Party Scenarios"
}

twoway line belief_M belief_ if bmale ==1 /// 
 , fcolor(ltblue ) lcolor(ltblue ) lwidth(vthick) lpattern(shortdash) /// 
 legend(label(1 "B(M)")) /// 
 || line belief_F belief_ if bfemale ==1 /// 
 , fcolor(none) lcolor(Participants) lwidth(vthick) lpattern(solid) /// 
 legend(label(2 "B(F)")) /// 
 title(`graph_title') ///
 xtitle("Believed % choosing socially-oriented outcome") /// 
 ytitle("CDF ", size(medium)) /// 
 subtitle("Mean B(F) = `avgF'" "Mean B(M) = `avgM' " , size(large) ) ///
 graphregion(color(white)) bgcolor(white) ///
 legend(off) ///
 xsize(4.5) ysize(4) 
 
 graph export `out'`graph_name'.pdf, replace 

 }
 
 

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////// FIGURE 1: ONLINE PARTICIPANTS /////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

foreach s in bfirstparty bneutral { 

clear
clear matrix
use `online_belief'
 
keep if `s' == 1 
 
quietly summarize belief_ if bfemale ==1, detail
local avgF: display %5.1f `r(mean)'

quietly summarize belief_ if bmale ==1, detail
local avgM: display %5.1f `r(mean)'

g tF = 100*truth_ if bfemale==1 
quietly summarize tF if bfemale==1 
local truthF: display %5.1f `r(mean)'

g tM = 100*truth_ if bmale==1 
quietly summarize tM if male==1 
local truthM: display %5.1f `r(mean)'

cumul belief_ if bfemale ==1 , gen(belief_F)
cumul belief_ if bmale ==1 , gen(belief_M)
sort belief_F belief_M

if ("`s'" == "bfirstparty") {
 local graph_name "Figure_1_Panel_b"

}

if ("`s'" == "bneutral") {
 local graph_name "Figure_1_Panel_d"

}

twoway line belief_M belief_ if bmale ==1 /// 
 , fcolor(ltblue ) lcolor(ltblue ) lwidth(vthick) lpattern(shortdash) /// 
 legend(label(1 "B(Male)")) /// 
 || line belief_F belief_ if bfemale ==1 /// 
 , fcolor(none) lcolor(Participants) lwidth(vthick) lpattern(solid) /// 
 legend(label(2 "B(Female)")) /// 
 xtitle("Believed % choosing socially-oriented outcome") /// 
 ytitle("CDF ", size(medium)) /// 
 legend(off) ///
 subtitle("Mean B(F) = `avgF'" " Mean B(M) = `avgM' " , size(large) ) ///
 graphregion(color(white)) bgcolor(white) ///
 xsize(4.5) ysize(4) 
 
 graph export `out'`graph_name'.pdf, replace 
 
}

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
/////////////////////////// TABLE 3 ////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear
clear matrix
use `interfering_exp_belief'
 
foreach i in base info_only exp_no ///
 exp_Fnice exp_Mnice exp_yes ///
 info_yes1 info_yes2 /// 
 {

 regress belief_ bfemale bmale ///
 if `i'==1 /// 
 , noconstant vce(cluster subject)
eststo g`i'0 
 
regress belief_ bfemale ///
 if `i'==1 /// 
 , vce(cluster subject)
eststo g`i'

}
 
esttab gbase0 ginfo_only0 gexp_Mnice0 gexp_Fnice0 ///
 using `out'Table_3.tex /// 
 , not nostar /// 
 title("Table 3") /// 
 mgroups( "Base" "Information Only" "Exp a nicer man" "Exp a nicer woman", pattern( 1 1 1 1 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
 nomtitles /// 
 nogaps compress /// 
 label /// 
 addnote("SEs clustered at subject level") replace 

 
esttab gbase ginfo_only gexp_Mnice gexp_Fnice ///
 using `out'Table_3_Delta.tex /// 
 , b(2) se(2) star(* 0.10 ** 0.05 *** 0.01) /// 
 title("Table 3: Delta") /// 
 mgroups( "Base" "Information Only" "Exp a nicer man" "Exp a nicer woman", pattern( 1 1 1 1 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
 nomtitles /// 
 nogaps compress noconstant /// 
 label /// 
 addnote("SEs clustered at subject level") replace 


//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
///////////////////// TABLE A17: UNDERGRADUATE STUDENTS ////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

foreach s in bneutral bfirstparty { 

clear
clear matrix
use `undergrad_belief'
 
keep if `s' == 1 

foreach i in all check first_b first_d ///
 bearly blate { 

 quietly regress belief_ bfemale ///
 FE* /// 
 if `i' == 1 /// 
 ,noconstant vce(cluster subject)
eststo gall_i`i'
}

 quietly regress belief_ bfemale ///
 female age_* major_economics FE* /// 
 if all == 1 /// 
 , noconstant vce(cluster subject)
eststo gall_iallC

if ("`s'" == "bfirstparty") {
 local table_name "Table_A17_Panel_1"
 local table_title "Undergraduate Students, Beliefs about First-Party Scenarios"
}

if ("`s'" == "bneutral") { 
 local table_name "Table_A17_Panel_3"
 local table_title "Undergraduate Students, Beliefs about Third-Party Scenarios"
}

esttab gall_iall gall_iallC gall_icheck gall_ifirst_b gall_ifirst_d gall_ibearly gall_iblate ///
 using `out'`table_name'.tex /// 
 , b(2) se(2) /// 
 title("`table_title'") /// 
 mtitles("All" "Controls" "Check" "B First" "B Second" "B Early" "B Late" ) ///
 nogaps compress /// 
 label /// 
 star(* 0.10 ** 0.05 *** 0.01 ) /// 
 addnote("Scenario FEs, SEs clustered at subject level") replace ///
 keep(bfemale) stats(N, fmt(%9.0gc)) 
}

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
///////////////////// TABLE A17: ONLINE PARTICIPANTS ///////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

foreach s in bneutral bfirstparty { 
 
clear
clear matrix
use `online_belief'
 
keep if `s' == 1 
 
foreach i in all check first_b first_d ///
 bearly blate ///
 { 

quietly regress belief_ bfemale ///
 FE* /// 
 if `i' ==1 /// 
 ,noconstant vce(cluster subject)
eststo gall_i`i'
}

quietly regress belief_ bfemale ///
 female age_* income_* FE* /// 
 if all==1 /// 
 , noconstant vce(cluster subject)
eststo gall_iallC

if ("`s'" == "bfirstparty") {

 
 local table_name "Table_A17_Panel_2"
 local table_title "Online Participants, Beliefs about First-Party Scenarios"
}

if ("`s'" == "bneutral") {

 
 local table_name "Table_A17_Panel_4"
 local table_title "Online Participants, Beliefs about Third-Party Scenarios"
}

esttab gall_iall gall_iallC gall_icheck gall_ifirst_b gall_ifirst_d gall_ibearly gall_iblate ///
 using `out'`table_name'.tex /// 
 , b(2) se(2) /// 
 title("`table_title'") /// 
 mtitles("All" "Controls" "Check" "B First" "B Second" "B Early" "B Late" ) ///
 nogaps compress /// 
 label /// 
 star(* 0.10 ** 0.05 *** 0.01 ) /// 
 addnote("Scenario FEs, SEs clustered at subject level") replace ///
 keep(bfemale) stats(N, fmt(%9.0gc))

}

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
///////////////////// TABLE A18: UNDERGRADUTE STUDENTS ///////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear
clear matrix
use `undergrad_long'

quietly estpost summarize belief_a_mworse belief_a_fworse belief_a_equal 
eststo rall

quietly estpost summarize belief_c_mworse belief_c_fworse belief_c_equal
eststo dall
 
foreach g in 1 2 3 4 5 6 7 { 

quietly estpost summarize belief_a_mworse belief_a_fworse belief_a_equal /// 
 if scenario == `g' 
eststo r`g'

quietly estpost summarize belief_c_mworse belief_c_fworse belief_c_equal /// 
 if scenario == `g' 
eststo d`g'

}

esttab rall r1 r2 r3 r4 r5 r6 r7 /// 
 using `out'Table_A18_Panel_1.tex /// 
 ,label cells("mean(fmt(2))") ///
 mtitles("All" "DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
 title("Undergraduate Students, Beliefs about First-Party Scenarios") stats(N, fmt(%9.0gc)) replace

esttab dall d1 d2 d3 d4 d5 d6 d7 /// 
 using `out'Table_A18_Panel_3.tex /// 
 ,label cells("mean(fmt(2))") ///
 mtitles("All" "DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
 title("Undergraduate Students, Beliefs about Third-Party Scenarios") stats(N, fmt(%9.0gc)) replace 

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
///////////////////// TABLE A18: ONLINE PARTICIPANTS /////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear
clear matrix
use `online_long'
 
estpost summarize belief_a_mworse belief_a_fworse belief_a_equal 
eststo rall

estpost summarize belief_c_mworse belief_c_fworse belief_c_equal
eststo dall
 
foreach g in 1 2 3 4 5 6 7 { 

estpost summarize belief_a_mworse belief_a_fworse belief_a_equal /// 
 if scenario == `g' 
eststo r`g'

estpost summarize belief_c_mworse belief_c_fworse belief_c_equal /// 
 if scenario == `g' 
eststo d`g'

}

esttab rall r1 r2 r3 r4 r5 r6 r7 /// 
 using `out'Table_A18_Panel_2.tex /// 
 ,label cells("mean(fmt(2))") ///
 mtitles("All" "DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
 title("Online Participants, Beliefs about First-Party Scenarios") stats(N, fmt(%9.0gc)) replace

esttab dall d1 d2 d3 d4 d5 d6 d7 /// 
 using `out'Table_A18_Panel_4.tex /// 
 ,label cells("mean(fmt(2))") ///
 mtitles("All" "DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
 title("Online Participants, Beliefs about Third-Party Scenarios") stats(N, fmt(%9.0gc)) replace 

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
///////////////////// TABLE A19: UNDERGRADUATE STUDENTS //////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////


foreach s in bneutral bfirstparty { 

clear
clear matrix
use `undergrad_belief'
 
keep if `s' == 1 

foreach g in 1 2 3 4 5 6 7 { 
quietly regress bgap_ deltaBF ///
 if scenario ==`g' /// 
 , vce(cluster subject)
eststo g`g'_iall

quietly regress bgap_ bfemale bmale ///
 if scenario ==`g' /// 
 , noconstant vce(cluster subject)
eststo d`g'_iall
} 

if ("`s'" == "bfirstparty") {
 local table_name "Table_A19_Panel_1" 
 
 local table_title "Undergraduate Students, Beliefs about First-Party Scenarios"
}

if ("`s'" == "bneutral") {
 local table_name "Table_A19_Panel_3"
 local table_title "Undergraduate Students, Beliefs about Third-Party Scenarios"
}

esttab d1_iall d2_iall d3_iall d4_iall d5_iall d6_iall d7_iall ///
 using `out'`table_name'.tex /// 
 , b(2) not nostar /// 
 title("`table_title'") /// 
 mtitles( "DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
 nogaps compress /// 
 label /// 
 addnote("SEs clustered at subject level") replace 
 
esttab g1_iall g2_iall g3_iall g4_iall g5_iall g6_iall g7_iall ///
 using `out'`table_name'_Delta.tex /// 
 , b(2) se(2) /// 
 title("`table_title'") /// 
 mtitles( "DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
 nogaps compress noconstant /// 
 label /// 
 star(* 0.10 ** 0.05 *** 0.01 ) /// 
 addnote("SEs clustered at subject level") replace 

}

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
///////////////////// TABLE A19: ONLINE PARTICIPANTS /////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

foreach s in bneutral bfirstparty { 

clear
clear matrix
use `online_belief'
 
keep if `s' == 1 
 
foreach g in 1 2 3 4 5 6 7 { 
quietly regress bgap_ deltaBF ///
 if scenario ==`g' /// 
 , vce(cluster subject)
eststo g`g'_iall

quietly regress bgap_ bfemale bmale ///
 if scenario ==`g' /// 
 , noconstant vce(cluster subject)
eststo d`g'_iall
} 

if ("`s'" == "bfirstparty") {
 local table_name "Table_A19_Panel_2" 
 
 local table_title "Online Participants, Beliefs about First-Party Scenarios"
}

if ("`s'" == "bneutral") {
 local table_name "Table_A19_Panel_4"
 local table_title "Online Participants, Beliefs about Third-Party Scenarios"
}

esttab d1_iall d2_iall d3_iall d4_iall d5_iall d6_iall d7_iall ///
 using `out'`table_name'.tex /// 
 , b(2) not nostar /// 
 title("`table_title'") /// 
 mtitles( "DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
 nogaps compress /// 
 label /// 
 addnote("SEs clustered at subject level") replace 
 
esttab g1_iall g2_iall g3_iall g4_iall g5_iall g6_iall g7_iall ///
 using `out'`table_name'_Delta.tex /// 
 , b(2) se(2) /// 
 title("`table_title'") /// 
 mtitles( "DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
 nogaps compress noconstant /// 
 label /// 
 star(* 0.10 ** 0.05 *** 0.01 ) /// 
 addnote("SEs clustered at subject level") replace 

}

 

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A20 //////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear
clear matrix
use `additional_demographics_long'

quietly regress ans bfemale ///
		, vce(cluster subject)
eststo r
 
quietly regress ans bfemale ///
		ageFE2 ageFE3 ageFE4 ///
		incomeFE2 incomeFE3 incomeFE4 incomeFE5 /// 
		,constant vce(cluster subject)
eststo rFE 

esttab r rFE ///
 using `out'Table_A20.tex /// 
 , b(2) se(2) star(* 0.10 ** 0.05 *** 0.01) /// 
	title("Beliefs about the percent of decision-makers choosing the socially-oriented outcome in the Economic Games (Additional Demographics) Study") /// 
	nogaps compress /// 
	label stats(N, fmt(%9.0gc)) /// 
	addnote("SEs clustered at subject level") replace	

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A21 //////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

 

clear
clear matrix
use `additional_demographics_long'

foreach a in 1 2 3 4 { 
foreach b in 1 2 3 4 5 { 
quietly regress ans bfemale bmale ///
		if ageFE`a' ==1 & incomeFE`b' == 1 /// 
		,noconstant vce(cluster subject)
eststo gA`a'`b' 

quietly regress ans bfemale ///
		if ageFE`a' ==1 & incomeFE`b' == 1 /// 
		,constant vce(cluster subject)
eststo g`a'`b' 
 }
 }

	esttab gA1* ///
 using `out'Table_A21_Panel_1.tex /// 
 , b(2) not nostar /// 
	title("Panel 1: Age: 18-24 years") /// 
	mgroups("18-25" "25-34" , pattern(1 0 0 0 0 1 0 0 0 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
	mtitles("0-25k" "25-50k" "50-75k" "75-100k" "100k+" "0-25k" "25-50k" "50-75k" "75-100k" "100k+" ) ///
	compress /// 
	 label /// 
	addnote("SEs clustered at subject level") replace	

	esttab gA2* ///
 using `out'Table_A21_Panel_2.tex /// 
 , b(2) not nostar /// 
	title("Panel 2: Age: 25-34 years") /// 
	mgroups("18-25" "25-34" , pattern(1 0 0 0 0 1 0 0 0 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
	mtitles("0-25k" "25-50k" "50-75k" "75-100k" "100k+" "0-25k" "25-50k" "50-75k" "75-100k" "100k+" ) ///
	compress /// 
	 label /// 
	addnote("SEs clustered at subject level") replace	

	esttab gA3* ///
 using `out'Table_A21_Panel_3.tex /// 
 , b(2) not nostar /// 
	title("Panel 3: Age: 35-44 years") /// 
	mgroups("35-44" "45+" , pattern(1 0 0 0 0 1 0 0 0 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
		mtitles("0-25k" "25-50k" "50-75k" "75-100k" "100k+" "0-25k" "25-50k" "50-75k" "75-100k" "100k+" ) ///
	compress /// 
	 label /// 
	addnote("SEs clustered at subject level") replace	
	

	esttab gA4* ///
 using `out'Table_A21_Panel_4.tex /// 
 , b(2) not nostar /// 
	title("Panel 4: Age: 45 years or above") /// 
	mgroups("35-44" "45+" , pattern(1 0 0 0 0 1 0 0 0 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
		mtitles("0-25k" "25-50k" "50-75k" "75-100k" "100k+" "0-25k" "25-50k" "50-75k" "75-100k" "100k+" ) ///
	compress /// 
	 label /// 
	addnote("SEs clustered at subject level") replace	
	

	esttab g1* ///
 using `out'Table_A21_Panel_1_Delta.tex /// 
 , b(2) se(2) star(* 0.10 ** 0.05 *** 0.01) /// 
	title("Panel 1: Age: 18-24 years: Delta") /// 
	mgroups("18-25" "25-34" , pattern(1 0 0 0 0 1 0 0 0 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
	mtitles("0-25k" "25-50k" "50-75k" "75-100k" "100k+" "0-25k" "25-50k" "50-75k" "75-100k" "100k+" ) ///
	compress noconstant /// 
	 label /// 
	addnote("SEs clustered at subject level") replace	
 
	esttab g2* ///
 using `out'Table_A21_Panel_2_Delta.tex /// 
 , b(2) se(2) star(* 0.10 ** 0.05 *** 0.01) /// 
	title("Panel 2: Age: 25-34 years: Delta") /// 
	mgroups("18-25" "25-34" , pattern(1 0 0 0 0 1 0 0 0 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
	mtitles("0-25k" "25-50k" "50-75k" "75-100k" "100k+" "0-25k" "25-50k" "50-75k" "75-100k" "100k+" ) ///
	compress noconstant /// 
	 label /// 
	addnote("SEs clustered at subject level") replace	
 

	esttab g3* ///
 using `out'Table_A21_Panel_3_Delta.tex /// 
 , b(2) se(2) star(* 0.10 ** 0.05 *** 0.01) /// 
	title("Panel 3: Age: 35-44 years: Delta") /// 
	mgroups("35-44" "45+" , pattern(1 0 0 0 0 1 0 0 0 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
		mtitles("0-25k" "25-50k" "50-75k" "75-100k" "100k+" "0-25k" "25-50k" "50-75k" "75-100k" "100k+" ) ///
	compress noconstant /// 
	 label /// 
	addnote("SEs clustered at subject level") replace	

	esttab g4* ///
 using `out'Table_A21_Panel_4_Delta.tex /// 
 , b(2) se(2) star(* 0.10 ** 0.05 *** 0.01) /// 
	title("Panel 4: Age: 45 years or above: Delta") /// 
	mgroups("35-44" "45+" , pattern(1 0 0 0 0 1 0 0 0 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
		mtitles("0-25k" "25-50k" "50-75k" "75-100k" "100k+" "0-25k" "25-50k" "50-75k" "75-100k" "100k+" ) ///
	compress noconstant /// 
	 label /// 
	addnote("SEs clustered at subject level") replace	



//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A22 //////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear
clear matrix
use `stakes_decisions'

foreach a in 1 2 3 4 5 6 7 8 9 10 { 
 regress gave female male ///
		if stakesFE`a' == 1 /// 
		,noconstant vce(cluster subject)
eststo g`a'b 

 regress gave female ///
		if stakesFE`a' == 1 /// 
		,constant vce(cluster subject)
eststo g`a' 
 }
 
	esttab g1b g2b g3b g4b g5b g6b g7b g8b g9b g10b ///
 using `out'Table_A22.tex /// 
 , b(2) not nostar /// 
	title("Rate of choosing the socially-oriented outcome in the Economic Games (Stakes Vary) Study") /// 
	mgroups("10 for self or \$X\$ for other, \$X\$ equals:" , pattern(1 0 0 0 0 0 0 0 0 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
	mtitles("2" "4" "6" "8" "10" "20" "40" "60" "80" "100" ) ///
	compress /// 
	 label /// 
	addnote("SEs clustered at subject level") replace	
	
	esttab g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 ///
 using `out'Table_A22_Delta.tex /// 
 , b(2) se(2) star(* 0.10 ** 0.05 *** 0.01) /// 
	title("Rate of choosing the socially-oriented outcome in the Economic Games (Stakes Vary) Study: Delta") /// 
		mgroups("10 for self or \$X\$ for other, \$X\$ equals:" , pattern(1 0 0 0 0 0 0 0 0 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
	mtitles("2" "4" "6" "8" "10" "20" "40" "60" "80" "100" ) ///
	compress noconstant /// 
	 label /// 
	addnote("SEs clustered at subject level") replace	
	

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A23 //////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear
clear matrix
use `stakes_beliefs'

foreach a in 1 2 3 4 5 6 7 8 9 10 { 
quietly regress belief bfemale bmale ///
		if stakesFE`a' == 1 /// 
		,noconstant vce(cluster subject)
eststo g`a'b 

quietly regress belief bfemale ///
		if stakesFE`a' == 1 /// 
		,constant vce(cluster subject)
eststo g`a' 
 }

esttab g1b g2b g3b g4b g5b g6b g7b g8b g9b g10b ///
 using `out'Table_A23.tex /// 
 , b(2) not nostar /// 
	title("Beliefs about the percent of decision-makers choosing the socially-oriented outcome in the Economic Games (Stakes Vary) Study") /// 
	mgroups("10 for self or \$X\$ for other, \$X\$ equals:" , pattern(1 0 0 0 0 0 0 0 0 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
	mtitles("2" "4" "6" "8" "10" "20" "40" "60" "80" "100" ) ///
	compress /// 
	 label /// 
	addnote("SEs clustered at subject level") replace	

esttab g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 ///
 using `out'Table_A23_Delta.tex /// 
 , b(2) se(2) star(* 0.10 ** 0.05 *** 0.01) /// 
	title("Beliefs about the percent of decision-makers choosing the socially-oriented outcome in the Economic Games (Stakes Vary) Study: Delta") /// 
	mgroups("10 for self or \$X\$ for other, \$X\$ equals:" , pattern(1 0 0 0 0 0 0 0 0 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
	mtitles("2" "4" "6" "8" "10" "20" "40" "60" "80" "100" ) ///
	compress noconstant /// 
	 label /// 
	addnote("SEs clustered at subject level") replace	
	

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A24: ONLINE PARTICIPANTS ////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

foreach s in bneutral bfirstparty { 

clear
clear matrix
use `broader_beliefs_online'
 
keep if `s' == 1 

foreach g in 1 2 3 4 5 6 7 { 
quietly regress hyp_ bfemale ///
		if scenario == `g' /// 
		, vce(cluster subject)
eststo g`g'_iall

quietly regress hyp_ bfemale bmale ///
		if scenario == `g' /// 
		, noconstant vce(cluster subject)
eststo d`g'_iall
}

if ("`s'" == "bfirstparty") {
 local table_name "Table_A24_Panel_1"
 local table_title "Online Participants, Beliefs about First-Party Scenarios"
}

if ("`s'" == "bneutral") {
 local table_name "Table_A24_Panel_3"
 local table_title "Online Participants, Beliefs about First-Party Scenarios"
}

 esttab d1_iall d2_iall d3_iall d4_iall d5_iall d6_iall d7_iall ///
 using `out'`table_name'.tex /// 
 , b(2) not nostar /// 
	title("`table_title'") /// 
	mtitles("DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
	nogaps compress /// 
	 label /// 
 varlabels(bfemale "B(F)") ///
	addnote("SEs clustered at subject level") stats(N, fmt(%9.0gc)) replace	

 esttab g1_iall g2_iall g3_iall g4_iall g5_iall g6_iall g7_iall ///
 using `out'`table_name'_Delta.tex /// 
 , b(2) se(2) /// 
	title("`table_title'") /// 
	mtitles("DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
	nogaps compress noconstant /// 
	 label /// 
 star(* 0.10 ** 0.05 *** 0.01 ) /// 
 varlabels(bfemale "\$\Delta\$") ///
	addnote("SEs clustered at subject level") stats(N, fmt(%9.0gc)) replace	

}

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A24: REPRESENTATIVE SAMPLE //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

foreach s in bneutral bfirstparty { 

clear
clear matrix
use `broader_beliefs_representative'
 
keep if `s' == 1 

foreach g in 1 2 3 4 5 6 7 { 
quietly regress hyp_ bfemale ///
		if scenario == `g' /// 
		, vce(cluster subject)
eststo g`g'_iall

quietly regress hyp_ bfemale bmale ///
		if scenario == `g' /// 
		, noconstant vce(cluster subject)
eststo d`g'_iall
}

if ("`s'" == "bfirstparty") {
 local table_name "Table_A24_Panel_2"
 local table_title "Representative Sample, Beliefs about First-Party Scenarios"
}

if ("`s'" == "bneutral") {
 local table_name "Table_A24_Panel_4"
 local table_title "Representative Sample, Beliefs about First-Party Scenarios"
}

 esttab d1_iall d2_iall d3_iall d4_iall d5_iall d6_iall d7_iall ///
 using `out'`table_name'.tex /// 
 , b(2) not nostar /// 
	title("`table_title'") /// 
	mtitles("DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
	nogaps compress /// 
	 label /// 
	addnote("SEs clustered at subject level") stats(N, fmt(%9.0gc)) replace	

 esttab g1_iall g2_iall g3_iall g4_iall g5_iall g6_iall g7_iall ///
 using `out'`table_name'_Delta.tex /// 
 , b(2) se(2) /// 
	title("`table_title'") /// 
	mtitles("DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
	nogaps compress noconstant /// 
	 label /// 
 star(* 0.10 ** 0.05 *** 0.01 ) /// 
 varlabels(bfemale "\$\Delta\$") ///
	addnote("SEs clustered at subject level") stats(N, fmt(%9.0gc)) replace	

}

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A25 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

 
foreach s in bneutral bfirstparty { 

clear
clear matrix
use `beliefs_only'
 
keep if `s' == 1 & all == 1 
 
foreach g in 1 2 3 4 5 6 7 { 
quietly regress belief_ deltaBF ///
		if scenario ==`g' /// 
		, vce(cluster subject)
eststo g`g'_iall

quietly regress belief_ bfemale bmale ///
		if scenario ==`g' /// 
		, noconstant vce(cluster subject)
eststo d`g'_iall
}

if ("`s'" == "bfirstparty") {
 local table_name "Table_A25_Panel_1"
 local table_title "Panel 1: First-Party Scenarios"
}

if ("`s'" == "bneutral") {
 local table_name "Table_A25_Panel_2"
 local table_title "Panel 2: Third-Party Scenarios"
}

 esttab d1_iall d2_iall d3_iall d4_iall d5_iall d6_iall d7_iall ///
 using `out'`table_name'.tex /// 
 , b(2) not nostar /// 
	title("`table_title'") /// 
	mtitles( "DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
	nogaps compress /// 
	 label /// 
	addnote("SEs clustered at subject level") replace	

	
 esttab g1_iall g2_iall g3_iall g4_iall g5_iall g6_iall g7_iall ///
 using `out'`table_name'_Delta.tex /// 
 , b(2) se(2) /// 
	title("`table_title': Delta") /// 
	mtitles( "DG" "DG-EFF" "DG-ENT" "UG" "TG" "PD" "PGG" ) /// 
	nogaps compress noconstant /// 
	 label /// 
 star(* 0.10 ** 0.05 *** 0.01 ) /// 
	addnote("SEs clustered at subject level") replace	
	
}

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A26 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear
clear matrix
use `undergrad_belief'
 
keep if bfirstparty == 1 
 
local DVbelief_ "Percent Belief of Socially-Oriented Outcome"
local DVbgap_ "(Percent Belief of Socially-Oriented Outcome) - (Percent Truth)"
local allL "All beliefs"
local bneutralL "B(NP) only"
local bfirstpartyL "B(P1) only"
 
local ivall "bneutral bfemaleXbneutral"
local ivall2 "female bfemaleXfemale bneutralXfemale bfemaleXbneutralXfemale"
local ivmaleD "equalD bfemaleXequalD"
local ivfemaleD "equalD bfemaleXequalD"
local ivallF "women_fair bfemaleXwomen_fair"
local ivallN "women_nice bfemaleXwomen_nice"
local ivallS "men_selfish bfemaleXmen_selfish"
local ivcheck " "
local ivfirst_b " "
local ivfirst_d " "
local ivbearly " "
local ivblate " "
local ivmale " "
local ivfemale " "

label variable bfemale "\$\Delta\$"

foreach i in all2 all check first_b first_d ///
 bearly blate male female maleD femaleD ///
	 allF allN allS { 

quietly regress belief_ bfemale `ivbfirstparty' `iv`i'' ///
		FE* /// 
		if `i' == 1 /// 
		,noconstant vce(cluster subject)
eststo gall_i`i'
}
	 
esttab gall_ifemale gall_imale gall_iall2 ///
	gall_ifemaleD gall_imaleD gall_iallN gall_iallS gall_iallF /// 
 using `out'Table_A26.tex /// 
 , b(2) se(2) /// 
	title("Heterogeneity regressions of the believed percent of decision-makers choosing the socially-oriented outcome in the first-party scenarios of the Economic Games (Undergraduate Students) Study") /// 
	mtitles("Women" "Men" "All" "Women" "Men" "All" "All" "All") ///
	nogaps compress /// 
	 label order(bfemale female bfemaleXfemale equalD bfemaleXequalD women_nice bfemaleXwomen_nice men_selfish bfemaleXmen_selfish women_fair bfemaleXwomen_fair) /// 
 star(* 0.10 ** 0.05 *** 0.01 ) /// 
 keep(bfemale female bfemaleXfemale equalD bfemaleXequalD women_nice bfemaleXwomen_nice men_selfish bfemaleXmen_selfish women_fair bfemaleXwomen_fair) ///
 stats(N, fmt(%9.0gc)) ///
	addnote("SEs clustered at subject level") replace	
	

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A27 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear
clear matrix
use `undergrad_belief'
 
keep if bneutral == 1 
 
local DVbelief_ "Percent Belief of Socially-Oriented Outcome"
local DVbgap_ "(Percent Belief of Socially-Oriented Outcome) - (Percent Truth)"
local allL "All beliefs"
local bneutralL "B(NP) only"
local bfirstpartyL "B(P1) only"

local ivall "bneutral bfemaleXbneutral"
local ivall2 "female bfemaleXfemale bneutralXfemale bfemaleXbneutralXfemale"
local ivmaleD "equalD bfemaleXequalD"
local ivfemaleD "equalD bfemaleXequalD"
local ivallF "women_fair bfemaleXwomen_fair"
local ivallN "women_nice bfemaleXwomen_nice"
local ivallS "men_selfish bfemaleXmen_selfish"
local ivcheck " "
local ivfirst_b " "
local ivfirst_d " "
local ivbearly " "
local ivblate " "
local ivmale " "
local ivfemale " "

label variable bfemale "\$\Delta\$"

foreach i in all2 all check first_b first_d ///
 bearly blate male female maleD femaleD ///
	 allF allN allS { 

quietly regress belief_ bfemale `iv`i'' ///
		FE* /// 
		if `i' ==1 /// 
		,noconstant vce(cluster subject)
eststo gall_i`i'
}

esttab gall_ifemale gall_imale gall_iall2 ///
	gall_ifemaleD gall_imaleD gall_iallN gall_iallS gall_iallF /// 
 using `out'Table_A27.tex /// 
 , b(2) se(2) /// 
	title("Heterogeneity regressions of the believed percent of decision-makers choosing the socially-oriented outcome in the third-party scenarios of the Economic Games (Undergraduate Students) Study") /// 
	mtitles("Women" "Men" "All" "Women" "Men" "All" "All" "All") ///
	nogaps compress /// 
	 label order(bfemale female bfemaleXfemale equalD bfemaleXequalD women_nice bfemaleXwomen_nice men_selfish bfemaleXmen_selfish women_fair bfemaleXwomen_fair) /// 
 star(* 0.10 ** 0.05 *** 0.01 ) /// 
	 keep(bfemale female bfemaleXfemale equalD bfemaleXequalD women_nice bfemaleXwomen_nice men_selfish bfemaleXmen_selfish women_fair bfemaleXwomen_fair) ///
	 stats(N, fmt(%9.0gc)) ///
	addnote("SEs clustered at subject level") replace	


//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A28 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear
clear matrix
use `online_belief'
 
keep if bfirstparty == 1 
 
local ivmaleD "equalD bfemaleXequalD"
local ivfemaleD "equalD bfemaleXequalD"

local ivallC2 "scale_diff_charity bfemaleXscale_diff_charity"
local ivallCO "scale_diff_coop bfemaleXscale_diff_coop"
local ivallT "scale_diff_trust bfemaleXscale_diff_trust"
local ivallF "scale_diff_fair bfemaleXscale_diff_fair "
local ivallA "scale_diff_altruistic bfemaleXscale_diff_altruistic "
local ivall2 "female bfemaleXfemale bneutralXfemale bfemaleXbneutralXfemale"
local ivall "bneutral bfemaleXbneutral"

local ivallL "scale_diff_luck bfemaleXscale_diff_luck"
 
local ivcheck " "
local ivfirst_b " "
local ivfirst_d " "
local ivveryfirst_b " "
local ivbearly " "
local ivblate " "
local ivmale " "
local ivfemale " "

foreach x in scale_diff_fair scale_diff_altruistic scale_diff_charity scale_diff_trust scale_diff_luck scale_diff_coop {
summarize `x' , detail
replace `x' = `x' - `r(mean)'
replace bfemaleX`x' = `x'*bfemale 
}
 
foreach i in allC2 allCO allT allL allF allA all2 all check first_b first_d veryfirst_b ///
 bearly blate male female maleD femaleD ///
	{ 

label variable bfemale "\$\Delta\$"

quietly regress belief_ bfemale `iv`i'' ///
		FE* /// 
		if `i' == 1 /// 
		,noconstant vce(cluster subject)
eststo gall_i`i'
}

esttab gall_ifemale gall_imale gall_iall2 ///
	gall_ifemaleD gall_imaleD /// 
		 gall_iallA	gall_iallC2 gall_iallF	 ///
 using `out'Table_A28.tex /// 
 , b(2) se(2) /// 
	title("Heterogeneity regressions of the believed percent of decision-makers choosing the socially-oriented outcome in the first-party scenarios of the Economic Games (Online Participants) Study") /// 
	mtitles("Women" "Men" "All" "Women" "Men" "All" "All" "All") ///
	nogaps compress /// 
	 label order(bfemale female bfemaleXfemale equalD bfemaleXequalD scale_diff_altruistic bfemaleXscale_diff_altruistic scale_diff_charity bfemaleXscale_diff_charity scale_diff_fair bfemaleXscale_diff_fair) /// 
 star(* 0.10 ** 0.05 *** 0.01 ) /// 
	 stats(N, fmt(%9.0gc)) ///
	 keep(bfemale female bfemaleXfemale equalD bfemaleXequalD scale_diff_altruistic bfemaleXscale_diff_altruistic scale_diff_charity bfemaleXscale_diff_charity scale_diff_fair bfemaleXscale_diff_fair) ///
	addnote("SEs clustered at subject level") replace	


//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A29 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
clear
clear matrix
use `online_belief'
 
keep if bneutral == 1 
 
local DVbelief_ "Percent Belief of Socially-Oriented Outcome"
local DVbgap_ "(Percent Belief of Socially-Oriented Outcome) - (Percent Truth)"
local allL "All beliefs"
local bneutralL "B(NP) only"
local bfirstpartyL "B(P1) only"

local ivall "bneutral bfemaleXbneutral"
local ivmaleD "equalD bfemaleXequalD"
local ivfemaleD "equalD bfemaleXequalD"
local ivall2 "female bfemaleXfemale bneutralXfemale bfemaleXbneutralXfemale"

local ivallC2 "scale_diff_charity bfemaleXscale_diff_charity"
local ivallA "scale_diff_altruistic bfemaleXscale_diff_altruistic "
local ivallF "scale_diff_fair bfemaleXscale_diff_fair "

local ivallCO "scale_diff_coop bfemaleXscale_diff_coop"
local ivallT "scale_diff_trust bfemaleXscale_diff_trust"
local ivallL "scale_diff_luck bfemaleXscale_diff_luck"
 
local ivcheck " "
local ivfirst_b " "
local ivfirst_d " "
local ivveryfirst_b " "
local ivbearly " "
local ivblate " "
local ivmale " "
local ivfemale " "
 
foreach x in scale_diff_fair scale_diff_altruistic scale_diff_charity scale_diff_trust scale_diff_luck scale_diff_coop {
summarize `x' , detail
replace `x' = `x' - `r(mean)'
replace bfemaleX`x' = `x'*bfemale 
}
 
foreach i in allC2 allCO allT allL allF allA all2 all check first_b first_d veryfirst_b ///
 bearly blate male female maleD femaleD ///
	{ 

label variable bfemale "\$\Delta\$"

quietly regress belief_ bfemale `iv`i'' ///
		FE* /// 
		if `i' ==1 /// 
		,noconstant vce(cluster subject)
eststo gall_i`i'
}

esttab gall_ifemale gall_imale gall_iall2 ///
	gall_ifemaleD gall_imaleD /// 
		 gall_iallA	gall_iallC2 gall_iallF	 ///
 using `out'Table_A29.tex /// 
 , b(2) se(2) /// 
	title("Heterogeneity regressions of the believed percent of decision-makers choosing the socially-oriented outcome in the third-party scenarios of the Economic Games (Online Participants) Study") /// 
	mtitles("Women" "Men" "All" "Women" "Men" "All" "All" "All") ///
	nogaps compress /// 
	 label order(bfemale female bfemaleXfemale equalD bfemaleXequalD scale_diff_altruistic bfemaleXscale_diff_altruistic scale_diff_charity bfemaleXscale_diff_charity scale_diff_fair bfemaleXscale_diff_fair) /// 
 star(* 0.10 ** 0.05 *** 0.01 ) /// 
	 stats(N, fmt(%9.0gc)) ///
	 keep(bfemale female bfemaleXfemale equalD bfemaleXequalD scale_diff_altruistic bfemaleXscale_diff_altruistic scale_diff_charity bfemaleXscale_diff_charity scale_diff_fair bfemaleXscale_diff_fair) ///
	addnote("SEs clustered at subject level") replace	


//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A30 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
clear
clear matrix
use `recalled_person'
 
keep if all == 1

quietly regress belief_ bfemale ///
		if stereo_female ==1 /// 
		, vce(cluster subject)
eststo rwoman

quietly regress belief_ bfemale ///
		if stereo_female ==0 /// 
		, vce(cluster subject)
eststo rman

quietly regress belief_ bfemale ///
	stereo_female bfemaleXstereo_female ///
		, vce(cluster subject)
eststo rall2

esttab rman rwoman rall2 ///
 	using `out'Table_A30.tex ///
 	, b(2) se(2) /// 
	title("Beliefs about the percent of decision-makers choosing the socially-oriented outcome in the first-party dictator game of the Recalled Person Study") ///
	mtitles( "Do Not Recall a Woman" "Recalled a Woman" "All" ) /// 
	nogaps compress /// 
	 label /// 
 	 star(* 0.10 ** 0.05 *** 0.01 ) /// 
	addnote("SEs clustered at subject level") replace	

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A31 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear
clear matrix
use `recalled_experience'
 
keep if all == 1 
 
local ivall2 "exp_mom bfemaleXexp_mom "

local ivexp_dad = " "
local ivexp_both = " "
local ivexp_mom = " "

foreach i in all2 ///
	exp_dad exp_both exp_mom /// 
	{
	
quietly	regress belief_ bfemale ///
		`iv`i'' /// 
		if `i' == 1 /// 
		, vce(cluster subject)
eststo g`i'

}

esttab gexp_dad gexp_both gexp_mom gall2 ///
 	using `out'Table_A31.tex /// 
 	, b(2) se(2) star(* 0.10 ** 0.05 *** 0.01) /// 
	title("Beliefs about the percent of decision-makers choosing the socially-oriented outcome in the Recalled Experience Study") /// 
		mtitles( "Men" "Neither" "Women" "All" ) /// 
	nogaps compress /// 
	 label /// 
	addnote("SEs clustered at subject level") replace	


//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A32 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear
clear matrix
use `recalled_experience'

keep if all == 1

foreach i in 1 2 3 4 5 6 7 { 

	quietly regress belief_ bfemale bmale ///
	if exp1 == `i' /// 
		, noconstant vce(cluster subject)
	eststo exp1`i'c
	
	quietly regress belief_ bfemale ///
	if exp1 == `i' /// 
		, vce(cluster subject)
	eststo exp1`i'

}
	
foreach i in 2 3 4 5 6 7 {	
	quietly regress belief_ bfemale bmale ///
	if exp2 ==`i' /// 
		, noconstant vce(cluster subject)
	eststo exp2`i'c
	
	quietly regress belief_ bfemale ///
	if exp2 ==`i' /// 
		, vce(cluster subject)
	eststo exp2`i'
}

esttab exp11c exp12c exp13c exp14c exp15c exp16c exp17c ///
 	using `out'Table_A32_Panel_1.tex /// 
 	, nostar not /// 
	title("Beliefs about the percent of decision-makers choosing the socially-oriented outcome in the Recalled Experience Study: Panel 1") /// 
	mtitles("1" "2" "3" "4" "5" "6" "7" ) /// 
	nogaps compress nonumbers /// 
	 label /// 
	addnote("SEs clustered at subject level") replace	

esttab exp11 exp12 exp13 exp14 exp15 exp16 exp17 ///
 	using `out'Table_A32_Panel_1_Delta.tex /// 
 	, b(2) se(2) star(* 0.10 ** 0.05 *** 0.01) /// 
	title("Beliefs about the percent of decision-makers choosing the socially-oriented outcome in the Recalled Experience Study: Panel 1 Delta") /// 
	mtitles("1" "2" "3" "4" "5" "6" "7" ) /// 
	nogaps compress noconstant nonumbers /// 
	 label coeflabels(bfemale "\$\Delta\$") /// 
	addnote("SEs clustered at subject level") replace	

esttab exp22c exp23c exp24c exp25c exp26c exp27c ///
 	using `out'Table_A32_Panel_2.tex /// 
 	,not nostar /// 
	title("Beliefs about the percent of decision-makers choosing the socially-oriented outcome in the Recalled Experience Study: Panel 2") /// 
	mtitles("2" "3" "4" "5" "6" "7" ) /// 
	nogaps compress nonumbers /// 
	 label /// 
	addnote("SEs clustered at subject level") replace	

esttab exp22 exp23 exp24 exp25 exp26 exp27 ///
 	using `out'Table_A32_Panel_2_Delta.tex /// 
 	, b(2) se(2) star(* 0.10 ** 0.05 *** 0.01) /// 
	title("Beliefs about the percent of decision-makers choosing the socially-oriented outcome in the Recalled Experience Study: Panel 2 Delta") /// 
	mtitles("2" "3" "4" "5" "6" "7" ) /// 
	nogaps compress noconstant nonumbers /// 
	 label coeflabels(bfemale "\$\Delta\$") /// 
	addnote("SEs clustered at subject level") replace	


//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A33 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear
clear matrix
use `interfering_experience_2'
 
keep if all == 1 

foreach i in base info_only ///
	exp_Fnice exp_Mnice /// 
	{

quietly regress belief_ bfemale bmale ///
		if `i' == 1 /// 
		, noconstant vce(cluster subject)
eststo g`i'0 
	
quietly regress belief_ bfemale ///
		if `i' == 1 /// 
		, vce(cluster subject)
eststo g`i'

}

esttab gbase0 ginfo_only0 gexp_Mnice0	gexp_Fnice0 ///
 	using `out'Table_A33.tex /// 
 	, not nostar /// 
	title("Regressions of the believed percent of decision-makers choosing the socially-oriented outcome in the first-party dictator game of the Interfering Experience (Robustness) Study by condition") /// 
	mgroups( "Base" "Information Only" "Socially-Oriented Man" "Socially-Oriented Woman", pattern( 1 1 1 1 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
	nomtitles /// 
	nogaps compress /// 
	 label /// 
	addnote("SEs clustered at subject level") replace	

	
esttab gbase ginfo_only gexp_Mnice	gexp_Fnice ///
 	using `out'Table_A33_Delta.tex /// 
 	, b(2) se(2) star(* 0.10 ** 0.05 *** 0.01) /// 
	title("Regressions of the believed percent of decision-makers choosing the socially-oriented outcome in the first-party dictator game of the Interfering Experience (Robustness) Study by condition") /// 
	mgroups( "Base" "Information Only" "Socially-Oriented Man" "Socially-Oriented Woman", pattern( 1 1 1 1 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
	nomtitles /// 
	nogaps compress noconstant /// 
	 label /// 
	 coeflabels(bfemale "\$\Delta\$") ///
	addnote("SEs clustered at subject level") replace	


//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A34 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear
clear matrix
use `equality_decisions'
 
keep if all == 1 
 
forvalues i=1(1)8 { 
 quietly regress equal_ female male ///
		if decision == `i' ///
		, noconstant vce(cluster subject) 
eststo r`i'0

 quietly regress equal_ deltaF ///
		if decision == `i' ///
		, vce(cluster subject) 
eststo r`i'
}

esttab r10 r20 r30 r40 r50 r60 r70 r80 ///
 	using `out'Table_A34.tex /// 
 	, b(2) not nostar /// 
	title("Agreement with equality statements in the Equality Attitudes \& Employer Study") /// 
	nogaps compress nonumbers /// 
	mtitles( "(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)") label /// 
	 	addnote("Robust SEs") replace	
	
esttab r1 r2 r3 r4 r5 r6 r7 r8 ///
 	using `out'Table_A34_Delta.tex /// 
 	, b(2) se(2) /// 
	title("Agreement with equality statements in the Equality Attitudes \& Employer Study: Delta") /// 
	nogaps compress noconstant nonumbers /// 
	mtitles( "(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)") label /// 
 	 star(* 0.10 ** 0.05 *** 0.01 ) /// 
	addnote("Robust SEs") replace	


//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A35 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear
clear matrix
use `equality_beliefs'

keep if all == 1 

forvalues i=1(1)8 { 
 quietly regress belief_ bfemale bmale ///
		if decision == `i' ///
		, noconstant vce(cluster subject) 
eststo r`i'0
}

forvalues i=1(1)8 { 
 quietly regress belief_ deltaBF ///
		if decision == `i' ///
		, vce(cluster subject) 
eststo r`i'
}

esttab r10 r20 r30 r40 ///
	r50 r60 r70 r80 ///
 	using `out'Table_A35.tex /// 
 	, b(2) not nostar nonumbers /// 
	title("Beliefs about the percent of participants indicating agreement with equality statements in the Equality Attitudes \& Employer Study") /// 
	mtitles( "(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)") label /// 
	addnote("Robust SEs") replace	

esttab r1 r2 r3 r4 r5 r6 r7 r8 ///
 	using `out'Table_A35_Delta.tex /// 
 	, b(2) se(2) /// 
	title("Beliefs about the percent of participants indicating agreement with equality statements in the Equality Attitudes \& Employer Study: Delta") /// 
	mtitles( "(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)") label /// 
 	star(* 0.10 ** 0.05 *** 0.01 ) /// 
	nonumbers noconstant ///
	addnote("Robust SEs") replace	

	 
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A36 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear all 
clear matrix
use `equality_beliefs'

local ivfirst_b " "
local ivfirst_d " "
local ivbearly " "
local ivblate " "
local ivcheck " "
local ivall " "
local ivallC "female age_* income_*"

foreach i in first_b first_d bearly blate check all allC { 
 quietly regress belief_ deltaBF ///
		`iv`i'' FE* ///
		if `i' == 1 ///
		, vce(cluster subject) 
eststo r`i'
}

esttab rall rallC rcheck rfirst_b rfirst_d rbearly rblate /// 
 	using `out'Table_A36.tex /// 
 	, label b(2) se(2) /// 
	title("Robustness regressions of the believed percent of decision-makers favoring equality in the Equality Attitudes \& Employer Study") /// 
	mtitles("All" "W/ Controls" "Attention Check" "Beliefs First" "Beliefs Second" "Early Beliefs" "Late Beliefs") ///
	keep(deltaBF) ///
	nogaps compress /// 
 	 star(* 0.10 ** 0.05 *** 0.01 ) /// 
	 stats(N, fmt(%9.0gc)) ///
	addnote("Robust SEs") replace 

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A37 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear
clear matrix
use `equality_long'
 
keep if all == 1 

quietly estpost summarize belief_diff /// 
		belief_mworse belief_equal belief_fworse 
eststo rall

foreach d in 1 2 3 4 5 6 7 8 { 
quietly estpost summarize belief_diff /// 
		belief_mworse belief_equal belief_fworse /// 
	if decision == `d' 
eststo r`d'
}

esttab rall r1 r2 r3 r4 r5 r6 r7 r8 /// 
	 using `out'Table_A37.tex /// 
	,label cells("mean(fmt(2))") ///
	title("In Equality Attitudes \& Employer Study, participant level classification of beliefs") ///
	mgroups( "All" "(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)", pattern( 1 1 1 1 1 1 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
 nomtitles /// 
 nogaps compress /// 
	nonumbers ///
	stats(N, fmt(%9.0gc)) ///
	drop(belief_diff) ///
	replace 


//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A38 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear
clear matrix
use `equality_beliefs'

keep if all == 1 

local ivmale " "
local ivmaleD "equal bfemaleXequal"
local ivfemaleD "equal bfemaleXequal"
local ivfemale " "
local ivall2 "female bfemaleXfemale"

foreach i in all2 male female maleD femaleD { 
 quietly regress belief_ deltaBF ///
		`iv`i'' FE* ///
		if `i' == 1 ///
		, vce(cluster subject) 
eststo r`i'
}

esttab rfemale rmale rall2 rfemaleD rmaleD /// 
 	using `out'Table_A38.tex /// 
 	, label b(2) se(2) /// 
	title("Heterogeneity regressions of the believed percent of participants favoring equality in the Equality Attitudes \& Employer Study") /// 
	mgroups( "Women" "Men" "All" "Women" "Men" , pattern( 1 1 1 1 1 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
	order(deltaBF female bfemaleXfemale equal bfemaleXequal) /// 
	nogaps compress /// 
	nomtitles /// 
	keep(deltaBF female bfemaleXfemale equal bfemaleXequal) ///
 	star(* 0.10 ** 0.05 *** 0.01 ) /// 
	stats(N, fmt(%9.0gc)) ///
	addnote("Robust SEs") replace


//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A39 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear
clear matrix
use `equality_beliefs'

keep if all == 1 

forvalues i=1(1)8 { 
 quietly regress bgap_ bfemale bmale ///
		if decision == `i' ///
		, noconstant vce(cluster subject) 
eststo r`i'0
}

forvalues i=1(1)8 { 
 quietly regress bgap_ deltaBF ///
		if decision == `i' ///
		, vce(cluster subject) 
eststo r`i'
}

label variable bfemale "B(F) \$-\$ Truth(F)"
label variable bmale "B(M) \$-\$ Truth(M)"

esttab r10 r20 r30 r40 ///
	r50 r60 r70 r80 ///
 	using `out'Table_A39.tex /// 
 	, b(2) not nostar /// 
	title("Results on the accuracy of the beliefs about equality statements in the Equality Attitudes \& Employer Study") /// 
	nogaps compress nonumbers /// 
	mtitles( "1" "2" "3" "4" "5" "6" "7" "8") label /// 
	addnote("Robust SEs") replace	

 esttab r1 r2 r3 r4 r5 r6 r7 r8 ///
 	using `out'Table_A39_Delta.tex /// 
 	, b(2) se(2) /// 
	title("Results on the accuracy of the beliefs about equality statements in the Equality Attitudes \& Employer Study") /// 
	nogaps compress noconstant nonumbers /// 
	mtitles( "1" "2" "3" "4" "5" "6" "7" "8") label /// 
 	 star(* 0.10 ** 0.05 *** 0.01 ) /// 
	addnote("Robust SEs") replace	


//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A40 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear
clear matrix
use `equality_beliefs_2'

local ivfirst_b " "
local ivfirst_d " "
local ivbearly " "
local ivblate " "
local ivcheck " "
local ivall " "
local ivallC "female age_25t34 age_35t44 age_45t54 age_55t64 age_65plus income_unstated  income_10t24 income_25t49 income_50t74 income_75t99 income_100t149 income_150t199 income_200plus"

foreach i in first_b first_d bearly blate check all allC { 
 quietly regress belief_ ///
		bfemale `iv`i'' ///
		if `i' == 1 /// 
		,constant vce(cluster subject)
eststo r`i'
}

esttab rall rallC rcheck rfirst_b rfirst_d rbearly rblate ///
 	using `out'Table_A40.tex ///
 	, label b(2) se(2) ///
	title("Robustness regressions of the believed percent of employers choosing Equal Pay in the Equality Attitudes \& Employer Study") ///
	 mgroups( "All" "W/ Controls" "Check" "B First" "B Second" "Early B" "Late B" , pattern( 1 1 1 1 1 1 1 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
	nogaps compress ///
	nomtitles wrap ///
	 constant ///
	star(* 0.10 ** 0.05 *** 0.01 ) ///
	 drop(age_* income_* female) ///
	addnote("Robust SEs") replace
 	

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A41 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
clear
clear matrix 
use `equality_beliefs_2'

local ivmaleD "equal bfemaleXequal"
local ivfemaleD "equal bfemaleXequal"
local ivall2 "female bfemaleXfemale"
local ivfemale " "
local ivmale " "

foreach i in female male all2 femaleD maleD { 
 quietly regress belief_ ///
		bfemale `iv`i'' ///
		if `i' == 1 /// 
		,constant vce(cluster subject)
eststo r`i'
}

esttab rfemale rmale rall2 rfemaleD rmaleD /// 
 	using `out'Table_A41.tex /// 
 	, label b(2) se(2) /// 
	title("Heterogeneity regressions of the believed percent of employers choosing equal pay in the Equality Attitudes \& Employer Study") /// 
	 mgroups( "Women" "Men" "All" "Women" "Men" , pattern( 1 1 1 1 1 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) /// 
	nogaps compress /// 
	nomtitles /// 
 	 star(* 0.10 ** 0.05 *** 0.01 ) /// 
	addnote("`s',robust SEs") replace	



//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A42 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
clear
clear matrix
use `professional_beliefs'

keep if all == 1 

forvalues i=1(1)8 { 
 quietly regress belief_ bfemale bmale ///
		if decision ==`i' ///
		, noconstant vce(cluster subject) 
eststo r`i'0
}

forvalues i=1(1)8 { 
 quietly regress belief_ deltaBF ///
		if decision ==`i' ///
		, vce(cluster subject) 
eststo r`i'
}

esttab r10 r20 r30 r40 ///
	r50 r60 r70 r80 ///
	using `out'Table_A43.tex /// 
 	, b(2) not nostar /// 
	title("Beliefs about the percent of individuals holding socially-oriented equality views in the Professional Participants Study") /// 
	nogaps compress nonumbers /// 
	mtitles( "(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)") label /// 
	addnote("Robust SEs") replace	

esttab r1 r2 r3 r4 r5 r6 r7 r8 ///
	using `out'Table_A43_Delta.tex /// 
 	, b(2) se(2) /// 
	title("Beliefs about the percent of individuals holding socially-oriented equality views in the Professional Participants Study: Delta") /// 
	nogaps compress noconstant nonumbers /// 
	mtitles( "(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)") label /// 
 	 star(* 0.10 ** 0.05 *** 0.01 ) /// 
	addnote("Robust SEs") replace	


//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A44 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear
clear matrix
use `professional'

* Make Generous Decisions
tab general1

* Make Decisions That Achieve Equality
tab general2

* Favor Equal Pay
tab general3

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A45 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

* Women are believed to be generous, which Helps as Leaders in Competitive
tab help1

* Women are believed to be generous, which Harms as Leaders in Competitive
tab harm1

* Women are believed to be generous, which Neither Helps nor Harms as Leaders in Competitive
tab noimpact1

* Women are believed to be generous, which Helps as Leaders in Cooperative
tab help2

* Women are believed to be generous, which Harms as Leaders in Cooperative
tab harm2

* Women are believed to be generous, which Neither Helps nor Harms as Leaders in Cooperative
tab noimpact2

* Women are believed to be generous, which Helps Being Hired in Competitive
tab help3

* Women are believed to be generous, which Harms Being Hired in Competitive
tab harm3

* Women are believed to be generous, which Neither Helps nor Harms Being Hired in Competitive
tab noimpact3

* Women are believed to be generous, which Helps Being Hired in Cooperative
tab help4

* Women are believed to be generous, which Harms Being Hired in Cooperative
tab harm4

* Women are believed to be generous, which Neither Helps nor Harms Being Hired in Cooperative
tab noimpact4

* Women are believed to be equality-oriented, which Helps as Leaders in Competitive
tab help5

* Women are believed to be equality-oriented, which Harms as Leaders in Competitive
tab harm5

* Women are believed to be equality-oriented, which Neither Helps nor Harms as Leaders in Competitive
tab noimpact5

* Women are believed to be equality-oriented, which Helps as Leaders in Cooperative
tab help6

* Women are believed to be equality-oriented, which Harms as Leaders in Cooperative
tab harm6

* Women are believed to be equality-oriented, which Neither Helps nor Harms as Leaders in Cooperative
tab noimpact6

* Women are believed to be equality-oriented, which Helps Being Hired in Competitive
tab help7

* Women are believed to be equality-oriented, which Harms Being Hired in Competitive
tab harm7

* Women are believed to be equality-oriented, which Neither Helps nor Harms Being Hired in Competitive
tab noimpact7

* Women are believed to be equality-oriented, which Helps Being Hired in Cooperative
tab help8

* Women are believed to be equality-oriented, which Harms Being Hired in Cooperative
tab harm8

* Women are believed to be equality-oriented, which Neither Helps nor Harms Being Hired in Cooperative
tab noimpact8

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// TABLE A46 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

clear
clear matrix
use `broader_beliefs_equality'
 
keep if all == 1 

forvalues i=1(1)16 { 
 quietly regress belief_ bfemale bmale ///
		if decision == `i' ///
		, noconstant vce(cluster subject) 
eststo r`i'0
}

esttab r10 r20 r30 r40 r50 r60 r70 r80 ///
 	using `out'Table_A46_Panel_2.tex /// 
 	, b(2) not nostar /// 
	title("Beliefs about the percent of men and women favoring equality in the Broader Beliefs (Equality Attitudes) Study: Panel 2: Beliefs about Applications Statements") /// 
	nogaps compress nonumbers /// 
	mtitles("A1" "A2" "A3" "A4" "A5" "A6" "A7" "A8" ) label /// 
	addnote("Robust SEs") replace	
		
esttab r160 r110 r100 r120 r150 r130 r140 r90 ///
 	using `out'Table_A46_Panel_1.tex /// 
 	, b(2) not nostar /// 
	title("Beliefs about the percent of men and women favoring equality in the Broader Beliefs (Equality Attitudes) Study: Panel 1: Beliefs about Economic Games") /// 
	nogaps compress /// 
	mtitles("EG1" "EG2" "EG3" "EG4" "EG5" "EG6" "EG7" "EG8" ) label /// 
	addnote("Robust SEs") replace	

forvalues i=1(1)16 { 
 quietly regress belief_ deltaBF ///
		if decision == `i' ///
		, vce(cluster subject) 
eststo r`i'
}

 esttab r1 r2 r3 r4 r5 r6 r7 r8 ///
 	using `out'Table_A46_Panel_2_Delta.tex /// 
 	, b(2) se(2) /// 
	title("Beliefs about the percent of men and women favoring equality in the Broader Beliefs (Equality Attitudes) Study: Panel 2: Beliefs about Applications Statements: Delta") /// 
	nogaps compress noconstant /// 
	mtitles("A1" "A2" "A3" "A4" "A5" "A6" "A7" "A8" ) label /// 
 	 star(* 0.10 ** 0.05 *** 0.01 ) /// 
	addnote("Robust SEs") replace	
	
 esttab r16 r11 r10 r12 r15 r13 r14 r9 ///
 	using `out'Table_A46_Panel_1_Delta.tex /// 
 	, b(2) se(2) /// 
	title("Beliefs about the percent of men and women favoring equality in the Broader Beliefs (Equality Attitudes) Study: Panel 1: Beliefs about Economic Games: Delta") /// 
	nogaps compress noconstant /// 
	mtitles("EG1" "EG2" "EG3" "EG4" "EG5" "EG6" "EG7" "EG8" ) label /// 
 	 star(* 0.10 ** 0.05 *** 0.01 ) /// 
	addnote("Robust SEs") replace	

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
////////////////////////// FIGURE B1 //////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

foreach g in 1 2 3 4 5 6 7 { 

clear
clear matrix
use `undergrad_belief'
 
keep if bfirstparty == 1 & scenario == `g' 

local g1 "DG"
local g2 "DG-EFF" 
local g3 "DG-ENT" 
local g4 "UG" 
local g5 "TG" 
local g6 "PD" 
local g7 "PGG" 

local name1 "a"
local name2 "b"
local name3 "c"
local name4 "d"
local name5 "e"
local name6 "f" 
local name7 "g" 

quietly summarize belief_ if bfemale == 1, detail
local avgF: display %5.1f `r(mean)'

quietly summarize belief_ if bmale == 1, detail
local avgM: display %5.1f `r(mean)'

cumul belief_ if bfemale == 1 , gen(belief_F)
cumul belief_ if bmale == 1 , gen(belief_M)
sort belief_F belief_M

twoway 	line belief_M belief_ if bmale ==1 /// 
	, fcolor(ltblue ) lcolor(ltblue ) lwidth(thick) lpattern(shortdash) /// 
	legend(label(1 "B(Male)")) /// 
	|| line belief_F belief_ if bfemale ==1 /// 
	, fcolor(none) lcolor(Participants) lwidth(thick) lpattern(solid) /// 
	xtitle("Believed % choosing socially-oriented outcome", size(medium)) /// 
	ytitle("CDF ", size(medium)) /// 
	subtitle("Mean B(F) = `avgF'" "Mean B(M) = `avgM' " , size(large) ) ///
	legend(off) ///
	graphregion(color(white)) bgcolor(white) ///
	xsize(4.5) ysize(4) 
	
 graph export `out'Figure_B1_`name`g''.pdf, replace 
 
 
 }

 

///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
////////////////////////// FIGURE B2 //////////////////
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////

foreach g in 1 2 3 4 5 6 7 { 

clear
clear matrix
use `online_belief'
 
keep if bfirstparty == 1 & scenario == `g'

local g1 "DG"
local g2 "DG-EFF" 
local g3 "DG-ENT" 
local g4 "UG" 
local g5 "TG" 
local g6 "PD" 
local g7 "PGG" 

local name1 "a"
local name2 "b"
local name3 "c"
local name4 "d"
local name5 "e"
local name6 "f" 
local name7 "g" 

quietly summarize belief_ if bfemale == 1, detail
local avgF: display %5.1f `r(mean)'

quietly summarize belief_ if bmale == 1, detail
local avgM: display %5.1f `r(mean)'

cumul belief_ if bfemale == 1 , gen(belief_F)
cumul belief_ if bmale == 1 , gen(belief_M)
sort belief_F belief_M

twoway line belief_M belief_ if bmale == 1 /// 
	, fcolor(ltblue ) lcolor(ltblue ) lwidth(thick) lpattern(shortdash) /// 
	legend(label(1 "B(Male)")) /// 
	|| line belief_F belief_ if bfemale == 1 /// 
	, fcolor(none) lcolor(Participants) lwidth(thick) lpattern(solid) /// 
	xtitle("Believed % choosing socially-oriented outcome", size(medium)) /// 
	ytitle("CDF ", size(medium)) /// 
	subtitle("Mean B(F) = `avgF'" " Mean B(M) = `avgM' " , size(large) ) ///
	legend(off) ///
	graphregion(color(white)) bgcolor(white) ///
	xsize(4.5) ysize(4) 
	
 graph export `out'Figure_B2_`name`g''.pdf, replace 
 

 }

///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
////////////////////////// FIGURE B3 //////////////////
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////

foreach g in 1 2 3 4 5 6 7 { 

clear
clear matrix
use `undergrad_belief'
 
keep if bneutral == 1 & scenario == `g' 

local g1 "DG"
local g2 "DG-EFF" 
local g3 "DG-ENT" 
local g4 "UG" 
local g5 "TG" 
local g6 "PD" 
local g7 "PGG"

local name1 "a"
local name2 "b"
local name3 "c"
local name4 "d"
local name5 "e"
local name6 "f" 
local name7 "g" 

quietly summarize belief_ if bfemale == 1, detail
local avgF: display %5.1f `r(mean)'

quietly summarize belief_ if bmale == 1, detail
local avgM: display %5.1f `r(mean)'

cumul belief_ if bfemale == 1 , gen(belief_F)
cumul belief_ if bmale == 1 , gen(belief_M)
sort belief_F belief_M

twoway 	line belief_M belief_ if bmale ==1 /// 
	, fcolor(ltblue ) lcolor(ltblue ) lwidth(thick) lpattern(shortdash) /// 
	legend(label(1 "B(Male)")) /// 
	|| line belief_F belief_ if bfemale ==1 /// 
	, fcolor(none) lcolor(Participants) lwidth(thick) lpattern(solid) /// 
	xtitle("Believed % choosing socially-oriented outcome", size(medium)) /// 
	ytitle("CDF ", size(medium)) /// 
	subtitle("Mean B(F) = `avgF'" "Mean B(M) = `avgM' " , size(large) ) ///
	legend(off) ///
	graphregion(color(white)) bgcolor(white) ///
	xsize(4.5) ysize(4) 
	
 graph export `out'Figure_B3_`name`g''.pdf, replace 
 
 
 }

///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
////////////////////////// FIGURE B4 //////////////////
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////

foreach g in 1 2 3 4 5 6 7 { 

clear
clear matrix
use `online_belief'
 
keep if bneutral == 1 & scenario == `g'

local g1 "DG"
local g2 "DG-EFF" 
local g3 "DG-ENT" 
local g4 "UG" 
local g5 "TG" 
local g6 "PD" 
local g7 "PGG" 

local name1 "a"
local name2 "b"
local name3 "c"
local name4 "d"
local name5 "e"
local name6 "f" 
local name7 "g" 

quietly summarize belief_ if bfemale == 1, detail
local avgF: display %5.1f `r(mean)'

quietly summarize belief_ if bmale == 1, detail
local avgM: display %5.1f `r(mean)'

cumul belief_ if bfemale == 1 , gen(belief_F)
cumul belief_ if bmale == 1 , gen(belief_M)
sort belief_F belief_M

twoway line belief_M belief_ if bmale == 1 /// 
	, fcolor(ltblue ) lcolor(ltblue ) lwidth(thick) lpattern(shortdash) /// 
	legend(label(1 "B(Male)")) /// 
	|| line belief_F belief_ if bfemale == 1 /// 
	, fcolor(none) lcolor(Participants) lwidth(thick) lpattern(solid) /// 
	xtitle("Believed % choosing socially-oriented outcome", size(medium)) /// 
	ytitle("CDF ", size(medium)) /// 
	subtitle("Mean B(F) = `avgF'" " Mean B(M) = `avgM' " , size(large) ) ///
	legend(off) ///
	graphregion(color(white)) bgcolor(white) ///
	xsize(4.5) ysize(4) 
	
 graph export `out'Figure_B4_`name`g''.pdf, replace 
 

 }

///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
////////////////////////// FIGURE B5(a) //////////////////
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////

clear
clear 
use `undergrad'

quietly summarize count_fbetter_overall , detail
local mean: display %5.2f `r(mean)'

local xlabscount_fbetter_overall "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 " 

local ylabs "0 10 20 30 40" 

twoway histogram count_fbetter_overall ///
	,percent width(1) gap(50) xlabel(`xlabscount_fbetter_overall', labsize(large)) ///
		ylabel(, nogrid labsize(large)) ///
	 xtitle("# of Times Believed That" "Women are More Socially-Oriented", size(large)) ytitle("Percent ", size(large)) color(black) ///
	 xtick(`xlabscount_fbetter_overall') discrete /// 
	 title("Average = `mean'") /// 
	graphregion(color(white)) bgcolor(white) 

graph export `out'Figure_B5_a.pdf, replace
	

///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
////////////////////////// FIGURE B5(b) //////////////////
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////

clear
clear 
use `online'

quietly summarize count_fbetter_overall , detail
local mean: display %5.2f `r(mean)'

local xlabscount_fbetter_overall "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 " 
local xlabscount_fbetter_fp "0 1 2 3 4 5 6 7 " 
local xlabscount_fbetter_np "0 1 2 3 4 5 6 7 " 

local ylabs "0 10 20 30 40" 

twoway histogram count_fbetter_overall ///
	,percent width(1) gap(50) xlabel(`xlabscount_fbetter_overall', labsize(large)) ///
		ylabel(, nogrid labsize(large)) ///
	 xtitle("# of Times Believed That" "Women are More Socially-Oriented", size(large)) ytitle("Percent ", size(large)) color(black) ///
	 xtick(`xlabscount_fbetter_overall') discrete /// 
	 title("Average = `mean'") /// 
	graphregion(color(white)) bgcolor(white) 

graph export `out'Figure_B5_b.pdf, replace

///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
////////////////////////// FIGURE B6 //////////////////
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////

foreach g in 1 2 3 4 5 6 7 8 { 

clear
clear matrix
use `equality_beliefs'
 
keep if all == 1 & decision == `g'
 
local g1 "A society should aim to equalize incomes."
local g2 `"The government should take measures to" "reduce differences in income levels."' 
local g3 `"All people should be paid equally for the same" "job regardless of how well they do the job."'
local g4 `"Spouses should take equal responsibility" "for the home and family."' 
local g5 `"Both parents should be equally involved" "in the upbringing of a child."' 
local g6 `"All people should have" "equal access to health care."' 
local g7 `"All people should have" "equal access to education."' 
local g8 `"All people should have equal access" "to suitable and affordable housing."' 

local name1 "a"
local name2 "b"
local name3 "c"
local name4 "d"
local name5 "e"
local name6 "f" 
local name7 "g" 
local name8 "h"

quietly summarize belief_ if bfemale == 1, detail
local avgF: display %5.1f `r(mean)'

quietly summarize belief_ if bfemale == 0, detail
local avgM: display %5.1f `r(mean)'

cumul belief_ if bfemale == 1 , gen(belief_F)
cumul belief_ if bfemale == 0 , gen(belief_M)
sort belief_F belief_M

twoway 	line belief_M belief_ if bfemale == 0 /// 
	, fcolor(ltblue ) lcolor(ltblue ) lwidth(thick) lpattern(shortdash) /// 
	legend(label(1 "B(Male)")) /// 
	|| line belief_F belief_ if bfemale == 1 /// 
	, fcolor(none) lcolor(Participants) lwidth(thick) lpattern(solid) /// 
	xtitle("Believed percent agreeing with:" "`g`g'' ", size(large)) /// 
	ytitle("CDF ", size(medium)) /// 
	subtitle("Mean B(F) = `avgF'" " Mean B(M) = `avgM' " , size(large) ) ///
	legend(off) ///
	graphregion(color(white)) bgcolor(white) ///
	xsize(4.5) ysize(4) 
	
 graph export `out'Figure_B6_`name`g''.pdf, replace 
 
 }

///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
////////////////////////// FIGURE B7 //////////////////
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////

clear
clear matrix
use `equality_beliefs_2'
 
keep if all == 1 

summarize belief_ if bfemale == 1, detail
local avgF: display %5.1f `r(mean)'

summarize belief_ if bfemale == 0, detail
local avgM: display %5.1f `r(mean)'

cumul belief_ if bfemale == 1 , gen(belief_F)
cumul belief_ if bfemale == 0 , gen(belief_M)
sort belief_F belief_M

twoway 	line belief_M belief_ if bfemale == 0 /// 
	, fcolor(ltblue ) lcolor(ltblue ) lwidth(thick) lpattern(shortdash) /// 
	legend(label(1 "B(Male)")) /// 
	|| line belief_F belief_ if bfemale == 1 /// 
	, fcolor(none) lcolor(Participants) lwidth(thick) lpattern(solid) /// 
	xtitle("Believed percent of employers" "choosing to pay workers equally", size(large)) /// 
	ytitle("CDF ", size(medium)) /// 
	subtitle("Mean B(F) = `avgF'" " Mean B(M) = `avgM' " , size(large) ) ///
	legend(off) ///
	graphregion(color(white)) bgcolor(white) ///
	xsize(4.5) ysize(4) 
	
 graph export `out'Figure_B7.pdf, replace 
 

	

